/*     */ package com.iris.egrant.web.struts2.tags;
/*     */ 
/*     */ import com.iris.egrant.utils.XMLHelper;
/*     */ import java.io.IOException;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import javax.servlet.jsp.JspException;
/*     */ import javax.servlet.jsp.JspTagException;
/*     */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*     */ import org.w3c.dom.Document;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class CrItemTag
/*     */   extends BodyTagSupport
/*     */ {
/*     */   private static final long serialVersionUID = -794756983208878349L;
/*  21 */   private String style = "";
/*     */   
/*  23 */   private String disabled = "";
/*     */   
/*     */   private String type;
/*     */   
/*  27 */   private String name = "";
/*  28 */   private String id = "";
/*  29 */   private String value = "";
/*     */ 
/*     */   
/*     */   private Map<String, Object> dataObject;
/*     */ 
/*     */ 
/*     */   
/*     */   public String getStyle() {
/*  37 */     return this.style;
/*     */   }
/*     */   
/*     */   public void setStyle(String style) {
/*  41 */     this.style = style;
/*     */   }
/*     */   
/*     */   public String getDisabled() {
/*  45 */     return this.disabled;
/*     */   }
/*     */   
/*     */   public void setDisabled(String disabled) {
/*  49 */     if (disabled == null) {
/*  50 */       disabled = "";
/*     */     }
/*  52 */     this.disabled = disabled;
/*     */   }
/*     */   
/*     */   public String getName() {
/*  56 */     return this.name;
/*     */   }
/*     */   
/*     */   public void setName(String name) {
/*  60 */     this.name = name;
/*     */   }
/*     */   
/*     */   public String getType() {
/*  64 */     return this.type;
/*     */   }
/*     */   
/*     */   public void setType(String type) {
/*  68 */     this.type = type;
/*     */   }
/*     */   
/*     */   public String getValue() {
/*  72 */     return this.value;
/*     */   }
/*     */   
/*     */   public void setValue(String value) {
/*  76 */     this.value = value;
/*     */   }
/*     */   
/*     */   private String handel() throws JspTagException {
/*  80 */     Document doc = (Document)this.pageContext.getAttribute("xmlData");
/*  81 */     StringBuilder output = new StringBuilder("");
/*  82 */     Set<String> readOnly = (Set<String>)this.dataObject.get("readOnly");
/*  83 */     if ("textarea".equals(this.type)) {
/*  84 */       if (readOnly.contains(this.name)) {
/*  85 */         output.append("<pre>");
/*  86 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/*  87 */         output.append("</pre>");
/*  88 */         output.append("<textarea style='display:none'>");
/*  89 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/*  90 */         output.append("</textarea>");
/*     */       } else {
/*     */         
/*  93 */         output.append("<textarea  name='" + this.name + "'>");
/*  94 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/*  95 */         output.append("</textarea>");
/*     */       } 
/*     */     }
/*  98 */     if ("text".equals(this.type)) {
/*  99 */       if (readOnly.contains(this.name)) {
/* 100 */         output.append("<pre>");
/* 101 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/* 102 */         output.append("</pre>");
/* 103 */         output.append("<input style='display:none'  name='" + this.name + "' type='text' ");
/* 104 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/* 105 */         output.append("/>");
/*     */       } else {
/* 107 */         output.append("<input style='display:none'  name='" + this.name + "' type='text' ");
/* 108 */         output.append(XMLHelper.parseDoc(doc).selectSingleNode("/data/" + this.name).getText());
/* 109 */         output.append("/>");
/*     */       } 
/*     */     }
/* 112 */     return output.toString();
/*     */   }
/*     */   
/*     */   public Map<String, Object> getDataObject() {
/* 116 */     return this.dataObject;
/*     */   }
/*     */   
/*     */   public void setDataObject(Map<String, Object> dataObject) {
/* 120 */     this.dataObject = dataObject;
/*     */   }
/*     */ 
/*     */   
/*     */   public int doStartTag() throws JspException {
/*     */     try {
/* 126 */       String bar = handel();
/* 127 */       this.pageContext.getOut().write(bar);
/* 128 */       return 0;
/* 129 */     } catch (IOException ioe) {
/* 130 */       throw new JspException(ioe.getMessage());
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   public int doEndTag() throws JspTagException {
/* 136 */     return 6;
/*     */   }
/*     */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\CrItemTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */